{% extends 'base.html' %}

{% block content %}
<div class="container mt-4">
    <h2>我的订单</h2>
    <div class="row">
        {% for order in orders %}
        <div class="col-md-12 mb-4">
            <div class="card">
                <div class="card-body">
                    <div class="d-flex justify-content-between align-items-center">
                        <h5 class="card-title">订单号：{{ order.order_number }}</h5>
                        <span class="badge bg-{{ order.status }}">{{ order.get_status_display }}</span>
                    </div>
                    <p class="card-text">
                        创建时间：{{ order.created_at|date:"Y-m-d H:i" }}<br>
                        总金额：¥{{ order.total_amount }}
                    </p>
                    <a href="{% url 'order_detail' order.id %}" class="btn btn-primary">查看详情</a>
                </div>
            </div>
        </div>
        {% empty %}
        <div class="col-12">
            <p>暂无订单</p>
        </div>
        {% endfor %}
    </div>
</div>
{% endblock %}